package com.pie4cloud.pie.job.biz.service.impl;

import cn.hutool.extra.spring.SpringUtil;
import com.pie4cloud.pie.job.api.dto.CallBackDto;
import com.pie4cloud.pie.job.biz.enums.ExecuteEnum;
import com.pie4cloud.pie.job.biz.service.execute.ExecuteService;
import com.pie4cloud.pie.job.biz.util.StringUtils;
import com.pie4cloud.pie.job.biz.service.CallBackService;
import org.springframework.stereotype.Service;

@Service
public class CallBackServiceImpl implements CallBackService {

	public void execute(CallBackDto callBackDto){
		if(StringUtils.isNotEmpty(callBackDto.getType())){
			String serviceName= ExecuteEnum.getService(callBackDto.getType());
			ExecuteService executeService= (ExecuteService) SpringUtil.getBean(serviceName);
			executeService.callBack(callBackDto);
		}

	}
}
